package cn.zj.note.todo;

import cn.zj.note.util.DateUtil;
import cn.zj.note.util.StrFmtUtil;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

public class Todo {
    private String title;
    private boolean status; // true-> done
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    private String resource;
    private String url;
    private List<Record> records;

    public Todo(String title) {
        this.title = title;
        this.resource = "";
        this.status = false;
        this.createTime = DateUtil.curLocalDateTime();
        this.updateTime = createTime;
        this.records = new ArrayList<>();
    }

    public void addRecord(Record record){
        this.records.add(record);
    }
    public String getIdTag(){
        return StrFmtUtil.fmtDate(this.getCreateTime())+this.getTitle();
}
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public boolean isStatus() {
        return status;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getResource() {
        return resource;
    }

    public void setResource(String resource) {
        this.resource = resource;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public List<Record> getRecords() {
        return records;
    }

    public void setRecords(List<Record> records) {
        this.records = records;
    }
}
